package com.rede.didiok.common.feign;

import java.util.List;
import java.util.Set;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import com.rede.didiok.common.config.feign.FeignConfiguration;
import com.rede.didiok.common.dto.ReportOption;
import com.rede.didiok.common.dto.community.MomentCommentDto;
import com.rede.didiok.common.dto.pay.PayOrderDto;
import com.rede.didiok.common.dto.rank.MemberCommentDto;
import com.rede.didiok.common.dto.user.*;
import com.rede.didiok.common.utils.R;

/**
 * @Author: Rede
 * @DateTime: 2023-08-14 21:26
 * @Description: 对 didiok-user 服务的远程调用 feign
 */
@FeignClient(name = "didiok-user", contextId = "didiok-user0", configuration = FeignConfiguration.class)
public interface UserFeignClient {

    /**
     * 根据用户名获取用户信息
     *
     * @param userName 用户名
     * @return
     */
    @RequestMapping(value = "/user/feign/user/getByUserName", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getByUserName(@RequestParam("userName") String userName);

    /**
     * 根据用户名获取用户信息
     *
     * @param nickname 用户昵称
     * @return
     */
    @RequestMapping(value = "/user/feign/user/getByNickname", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getByNickname(@RequestParam("nickname") String nickname);

    /**
     * 批量向关注该用户【管理员】的人发送通知
     *
     * @param noticeVO
     * @return
     */
    @PostMapping(value = "/user/feign/notice/watch/add/batch", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String batchAddNoticeByWatch(@RequestBody NoticeDto noticeDto);

    /**
     * 用户脱敏【去除敏感信息】
     */
    @PostMapping(value = "/user/feign/user/convert", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String convertUser(@RequestBody UserDto user);

    /**
     * 设置用户头像
     *
     * @return
     */
    @PostMapping(value = "/user/feign/user/avatar/set", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String setUserAvatar(@RequestBody UserDto user);

    /**
     * 获取指定状态的管理员
     * @param status
     * @return
     */
    @GetMapping(value = "/user/feign/admin/listbystatus", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String listAdminByStatus(@RequestParam("status") Integer status);

    /**
     * 批量保存 notice 数据
     * @param noticeList
     */
    @PostMapping(value = "/user/feign/notice/saveBatch", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String saveNoticeBatch(@RequestBody List<NoticeDto> noticeList);


    /**
     * 获取带头像的用户Map
     *
     * @param ids
     * @return
     */
    @GetMapping(value = "/user/feign/user/getUserAvatarMapByIds", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getUserAvatarMapByIds(@RequestParam("ids") List<String> ids);

    /**
     * 获取带头像的用户Map
     *
     * @param ids
     * @return
     */
    @GetMapping(value = "/user/feign/user/listUserNameAndAvatarByUids", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R listUserNameAndAvatarByUids(@RequestParam("ids") List<String> ids);
//
//    /**
//     * 增加积分
//     *
//     * @param
//     * @return
//     */
//    @RequestMapping(value = "/user/feign/user/addUserCredits", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
//    String addUserCredits(@RequestParam("action") String action, @RequestParam("credits") Integer credits, @RequestParam("resourceUid") String resourceUid, @RequestParam("userUid") String userUid);

    /**
     * 根据用户id找用户
     *
     * @param
     * @return
     */
    @RequestMapping(value = "/user/feign/user/getById", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getUserById(@RequestParam("uid") String uid);

    /**
     * 根据用户id找用户(批量)
     *
     * @param
     * @return
     */
    @RequestMapping(value = "/user/feign/user/listUser", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String listUser(@RequestParam("userUids") Set<String> userUids);

    /**
     * 获取用户关注的用户
     *
     * @param
     * @return
     */
    @RequestMapping(value = "/user/feign/userWatch/listUserWatchIdsByUserUid", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R listUserWatchIdsByUserUid(@RequestParam("userUid") String userUid);

    /**
     * 获取用户相关的一些总记录数
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/index/getTotalCount", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getTotalCount();

    /**
     * 获取最近一周用户独立IP数和访问量
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/index/getWebVisitByWeek", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getWebVisitByWeek();

    /**
     * 获取代办事项列表
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/todo/getPageList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getTodoPageList(@RequestBody TodoDto todoDto);

    /**
     * 增加代办事项
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/todo/addTodo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String addTodo(@RequestBody TodoDto todoVO);

    /**
     * 编辑代办事项
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/todo/editTodo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String editTodo(@RequestBody TodoDto todoVO);

    /**
     * 删除代办事项
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/todo/deleteTodo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteTodo(@RequestBody TodoDto todoVO);

    /**
     * 批量编辑代办事项
     *
     * @return
     */
    @RequestMapping(value = "/user/feign/todo/editBatchTodo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String editBatchTodo(@RequestBody TodoDto todoVO);

    /**
     * 根据用户uid列表查询用户
     * @param uidList
     * @return
     */
    // TODO @RequestParam能传输list数据吗
    @RequestMapping(value = "/user/feign/user/listUserByUids", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R listUserByUids(@RequestParam("uidList") List<String> uidList);

    /**
     * 查询用户获取积分情况
     * 该接口为了解决 用户积分获取异常问题
     * 获取数据 包括
     * 签到数据
     * 博客数据
     * 问答数据
     * 评论数据
     *
     * @param userDto
     * @return
     */
    @RequestMapping(value = "/user/feign/user/queryCredits", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String queryCredits(@RequestBody UserDto userDto);

    /**
     * 获取反馈列表
     * @param feedbackDto
     * @return
     */
    @RequestMapping(value = "/user/feign/feedback/getList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getFeedbackPageList(@RequestBody FeedbackDto feedbackDto);

    /**
     * 新增/编辑反馈
     * @param feedbackDto
     * @return
     */
    @RequestMapping(value = "/user/feign/feedback/edit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String addFeedback(@RequestBody FeedbackDto feedbackDto);

    /**
     * 批量删除反馈
     * @param feedbackList
     * @return
     */
    @RequestMapping(value = "/user/feign/feedback/deleteBatch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteBatchFeedback(@RequestBody List<FeedbackDto> feedbackList);


    /**
     * 获取用户信息列表
     * @param userDto
     * @return
     */
    @RequestMapping(value = "/about/user/getUserListByPage", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    List<UserDto> getUserListByPage(UserDto userDto);

    /**
     * 获取用户信息列表
     * @param generalEditDto
     * @return
     */
    @RequestMapping(value = "/user/feign/generalEdit/getGeneralEditList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getGeneralEditList(@RequestBody GeneralEditDto generalEditDto);

    /**
     * 批量删除问题
     * @param generalEditDtoList
     * @return
     */
    @RequestMapping(value = "/user/feign/generalEdit/deleteBatch", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteBatchGeneralEdit(@RequestBody List<GeneralEditDto> generalEditDtoList);

    /**
     * 批量删除问题
     * @param generalEditDto
     * @return
     */
    @RequestMapping(value = "/user/feign/generalEdit/audit", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String auditGeneralEdit(@RequestBody GeneralEditDto generalEditDto);

    /**
     * 查询通用修改信息
     * @param uid
     * @return
     */
    @RequestMapping(value = "/user/feign/generalEdit/getById", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getGeneralEditById(@RequestParam("uid") String uid);

    /**
     * 修改通用修改记录
     * @param generalEditDto
     * @return
     */
    @RequestMapping(value = "/user/feign/generalEdit/getById", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R updateGeneralEditById(@RequestBody GeneralEditDto generalEditDto);

    /**
     * 获取通知列表
     * @param noticeDto
     * @return
     */
    @RequestMapping(value = "/user/feign/notice/getList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getNoticePageList(@RequestBody NoticeDto noticeDto);

    /**
     * 新增通知
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/add", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String addNotice(@RequestBody NoticeDto noticeDto);

    /**
     * 新增通知
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/edit", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String editNotice(@RequestBody NoticeDto noticeDto);

    /**
     * 删除通知
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/delete", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteNotice(@RequestBody NoticeDto noticeDto);

    /**
     * 获取后台站内信列表
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/getBackNoticeList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getBackNoticeList(NoticeDto noticeDto);

    /**
     * 批量删除后台通知
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/deleteBatchBlackNotice", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteBatchNotice(@RequestBody List<NoticeDto> noticeDtoList);

    /**
     * 删除站内信小红点提示
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/deleteRedisBatchNotice", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    void deleteRedisBatchNotice();

    /**
     * 获取后台站内信消息数量
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/deleteRedisBatchNotice", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String searchAllNoticeCount();

    /**
     * 根据userUids 获取 开启邮件通知 的用户
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/notice/listUserStartEmailNotification", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R listUserStartEmailNotification(@RequestBody Set<String> userUids);

    /**
     * 获取举报列表
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/report/getList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getReportPageList(@RequestBody ReportDto reportDto);

    /**
     * 批量删除举报列表
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/report/deleteBatch", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String batchDeleteReport(@RequestBody List<String> reportUidList);

    /**
     * 获取举报信息
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/report/list", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String queryListByContent(@RequestBody ReportOption reportOption);

    /**
     * 处理举报信息
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/report/handle", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String handleReport(@RequestParam("reportContentUid") String reportContentUid,
                        @RequestParam("reportType") String reportType,
                        @RequestParam("reportUid") String reportUid,
                        @RequestParam("progress") Integer progress);

    /**
     * 通过ids获取用户列表【携带用户头像和背景图片】
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/getUserListAndAvatarByIds", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getUserListAndAvatarByIds(@RequestBody Set<String> userUidList);

    /**
     * 通过id获取用户【携带用户头像和背景图片】
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/getUserListAndAvatarById", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getUserListAndAvatarById(@RequestParam("userUid") String userUid);

    /**
     * 通过ids获取用户列表【“不”携带用户头像和背景图片】
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/getUserListWithoutAvatarByIds", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getUserListWithoutAvatarByIds(Set<String> userUidList);

    /**
     * 获取用户列表
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/getList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getUserPageList(@RequestBody UserDto userDto);

    /**
     * 获取用户记录
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/getRecords", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getUserPageRecords(@RequestBody UserDto userDto);

    /**
     * 新增用户
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/add", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String addUser(@RequestBody UserDto userDto);

    /**
     * 编辑用户
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/edit", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String editUser(@RequestBody UserDto userDto);

    /**
     * 删除用户
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/delete", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String deleteUser(@RequestBody UserDto userDto);

    /**
     * 重置用户密码
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/resetUserPassword", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String resetUserPassword(@RequestBody UserDto userDto);

    /**
     * 用户第三方账号刷数
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/user/flushUserAccount", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String flushUserAccount();

    /**
     * 获取用户访问列表
     *
     * @param noticeVO
     */
    @PostMapping(value = "/user/feign/webVisit/getList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getWebVisitPageList(@RequestBody WebVisitDto webVisitDto);

    /**
     * 关闭邮件通知
     *
     * @param userUid
     */
    @GetMapping(value = "/user/feign/user/closeEmailNotificationById", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R closeEmailNotificationById(@RequestParam("userUid") String userUid);

    /**
     * 通过页大小获取友链列表
     *
     * @param noticeVO
     */
    @GetMapping(value = "/user/feign/link/getListByPageSize", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R getLinkListByPageSize(Integer size);

    /**
     *  获取TopN的用户【积分倒排】
     *
     * @param userDto
     */
    @PostMapping(value = "/user/feign/user/getUserTopN", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String getUserTopN(@RequestBody UserDto userDto);

    /**
     * at事件通用处理方法
     * @param userUid
     * @param toUserUid
     * @param toUid
     * @param bizUid
     * @param bizType
     * @param message
     * @param isAt
     * @return
     */
    @GetMapping(value = "/user/feign/user/atEventHandler", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    R atEventHandler(@RequestParam("userUid") String userUid,
                     @RequestParam("toUserUid") String toUserUid,
                     @RequestParam("toUid") String toUid,
                     @RequestParam("bizUid") String bizUid,
                     @RequestParam("bizType") String bizType,
                     @RequestParam("message") String message,
                     @RequestParam("isAt") boolean isAt);


    /**
     * 通过榜单成员评论发送通知
     * @param comment
     * @return
     */
    @PostMapping(value = "/user/feign/notice/sendNoticeByMemberComment", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String sendNoticeByMemberComment(@RequestBody MemberCommentDto comment);

    /**
     * 通过用户动态评论发送通知
     * @param comment
     * @return
     */
    @PostMapping(value = "/user/feign/notice/sendNoticeByMomentComment", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String sendNoticeByMomentComment(@RequestBody MomentCommentDto comment);

    /**
     * 保存notice
     * @param notice
     * @return
     */
    @PostMapping(value = "/user/feign/notice/saveNotice", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String saveNotice(@RequestBody NoticeDto notice);

    /**
     * 通过用户动态评论发送通知
     * @param payOrder
     * @return
     */
    @PostMapping(value = "/user/feign/notice/sendNoticeByPayOrder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String sendNoticeByPayOrder(@RequestBody PayOrderDto payOrder);

    /**
     * 通过用户动态评论发送通知
     * @param payOrder
     * @return
     */
    @PostMapping(value = "/user/feign/notice/sendNoticeByCancelOrder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String sendNoticeByCancelOrder(@RequestBody PayOrderDto payOrder);
}
